Feat/vitest test infrastructure.apits unit tests and ci pipeline - #31
Merged
Dannyswiss1 merged 2 commits intoAug 3, 2026
Merged
Conversation
Dashetty
added a commit
to Dashetty/LockA-Health-Provider-Client
that referenced
this pull request
Aug 3, 2026
Upstream added Vitest tests and a CI workflow (PR LockA-Medical-Passport#31) after the guide was first drafted. Update the testing section with the real commands (npm test, test:watch, test:coverage), require tests on changes, and note the CI gate so contributors know what must pass before merging. Closes LockA-Medical-Passport#29
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Vitest test infrastructure, api.ts unit tests, and CI pipeline
Summary
jsdomenvironment, jest-dom matchers, coverage via v8) as the project's test infrastructure, with a smoke test onBadgeproving the pipeline end to end.src/lib/api.ts), covering all 12 exported functions, their audit-log side effects, sort ordering, and not-found paths — using fake timers to flush the artificial network latency deterministically instead of waiting on real time.mainand every PR, scoped toclient/.Details
vite.config.tsextended viavitest/config'sdefineConfigwith atestblock (jsdom,setupFiles, v8 coverage reporters)src/test/setup.tswires in@testing-library/jest-domnpm test,npm run test:watch,npm run test:coveragesrc/lib/api.test.tsresets the module registry per test (the mock API holds mutable module-level state) and usesvi.advanceTimersByTimeAsyncto flush delays.github/workflows/ci.yml: Node 22,npm ci→npm run lint→npm run build→npm testclient/README.mddocuments the test commands;coverage/added to.gitignoreTest plan
npm run lint— clean (only 2 pre-existing, unrelated fast-refresh warnings)npm run build— type-checks and builds cleannpm test— 20/20 tests passingnpm run test:coverage— coverage report generates correctlyjs-yamlparse)Closes #3
Closes #4
Closes #5